﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FileIo
{
    class Program
    {
        static void Main(string[] args)
        {
            //获取 D 盘中的驱动器类型、名称、文件系统名称、可用空间以及总空间大小。
            /*  DriveInfo driveInfo = new DriveInfo("D");
              Console.WriteLine("驱动器的名称："+driveInfo.Name);
              Console.WriteLine("驱动器类型："+driveInfo.DriveType);
              Console.WriteLine("驱动器的文件格式："+driveInfo.DriveFormat);
              Console.WriteLine("驱动器中可用空间大小："+driveInfo.TotalFreeSpace);
              Console.WriteLine("驱动器总大小："+driveInfo.TotalSize);
              Console.WriteLine();
              DriveInfo[] driveInfo1 = DriveInfo.GetDrives();
              foreach(DriveInfo d in driveInfo1)
              {
                  if (d.IsReady)
                  {
                      Console.WriteLine("驱动器名称："+d.Name);
                      Console.WriteLine("驱动器的文件格式："+d.DriveFormat);
                  }
              }*/


            //增文件夹

            //  DirectoryInfo directoryInfo = new DirectoryInfo("E:\\code");
            //directoryInfo.Create();
            // directoryInfo.CreateSubdirectory("code-1");
            // directoryInfo.CreateSubdirectory("code-2");

            //查文件

            //  DirectoryInfo directoryInfo = new DirectoryInfo("E:\\code");
            //  IEnumerable<DirectoryInfo> dir = directoryInfo.EnumerateDirectories();
            // foreach(var v in dir)
            // {
            //   Console.WriteLine(v.Name);
            // }

            //删文件

            DirectoryInfo directoryInfo = new DirectoryInfo("E:\\code");
            directoryInfo.Delete(true);
        }
    }
}
